package leetcode;

public class _206 {

	public ListNode reverseList(ListNode head) {

		if (null == head || null == head.next) {
			return head;
		} else {

			ListNode pre = null;
			ListNode current = head.next;
			ListNode next = null;

			while (null != current) {
				if (null == pre) {
					pre = head;
					pre.next = null;
				}
				next = current.next;
				current.next = pre;
				pre = current;
				if (null != next) {
					current = next;
				} else {
					break;
				}
			}

			return current;
		}

	}

}
